<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        h1{
            color: darkgoldenrod;
            /* text-shadow: 0 2px .1vw yellow; */
        }
    </style>
</head>
<body>
    <h1></h1>
    <script>
        let h1 = document.querySelector('h1');
        let stars = '★★★★★☆☆☆☆☆';

        function judgeRate(rate){
            return stars.slice(5-rate,10-rate);
        }

        h1.innerHTML = judgeRate(4);

    </script>
</body>
</html>